# encoding:utf-8

import requests
import base64

'''
图像对比度增强
'''

request_url = "https://aip.baidubce.com/rest/2.0/image-process/v1/contrast_enhance"
# 二进制方式打开图片文件
f = open("C:\Users\Administrator\Desktop\hhh.jpg" , "rb")
img = base64.b64encode(f.read())

params = {"image":img}
access_token = "[调用鉴权接口获取的token]"
request_url = request_url + "?access_token=" + access_token
headers = {"content-type": "application/x-www-form-urlencoded"}
response = requests.post(request_url, data=params, headers=headers)
if response:
    print (response.json())